package com.leonardo.persistenceme.model.filters;

import com.leonardo.persistenceme.model.Entity;
import com.leonardo.persistenceme.model.Filter;

public class ClassFilter implements Filter {

	private final Class clazz;
	
	public ClassFilter(Class clazz) {
		if(clazz == null)
			throw new RuntimeException("ClassFilter cannot receive a null class");
		this.clazz = clazz;
	}
	
	public boolean accept(Entity obj) {
		if(obj == null)
			return false;
		return clazz.equals(obj.getClass());
	}

}
